import { gameState } from './state.js';

export const Player = {
    maxHealth: 100,
    currentHealth: 100,
    attack: 10,
    attackLevel: 1,
    healRate: 1,
    healLevel: 1,
	
	// 添加setter方法
	set attack(value) {
		this._attack = value;
		document.getElementById('playerAttack').textContent = value;
	},
	get attack() {
		return this._attack;
	},

    init() {
		Player.attack=50;
        this.currentHealth = this.maxHealth;
    },

    heal() {
        this.currentHealth = Math.min(
            this.currentHealth + this.healRate,
            this.maxHealth
        );
    }
};